/*-------------------------------------------------------------------------------------------------------------------------
	Kick a player
-------------------------------------------------------------------------------------------------------------------------*/

local PLUGIN = {}
PLUGIN.Title = "ItelliBan warn"
PLUGIN.Description = "Give a player an IntelliBan Warning."
PLUGIN.Author = "Roelof"
PLUGIN.ChatCommand = "ibwarn"
PLUGIN.Usage = "<player>"
PLUGIN.Privileges = { "Ban" }

function PLUGIN:Call( ply, args )
	if ( ply:EV_HasPrivilege( "Ban" ) ) then
		local pl = evolve:FindPlayer( args[1] )
		if ( #pl > 1 ) then
			evolve:Notify( ply, evolve.colors.white, "Did you mean ", evolve.colors.red, evolve:CreatePlayerList( pl, true ), evolve.colors.white, "?" )
		elseif ( #pl == 1 ) then
			local reason = table.concat( args, " ", 2 ) or ""
			
			for _, v in ipairs( ents.GetAll() ) do
				if ( v:EV_GetOwner() == pl[1]:UniqueID() ) then v:Remove() end
			end
			evolve:Notify( evolve.colors.blue, ply:Nick(), evolve.colors.white, " has given ", evolve.colors.red, pl[1]:Nick(), evolve.colors.white, " an IntelliBan warning." )
			http.Get("http://roelofr.djoamersfoort.nl/intelliban/givewarning.php?steamid="..pl[1]:SteamID().."&clanid="..IntelliBan_ClanID,"", function(args,c,s)
				checkIntellibanPlayer(args[1])
			end,pl[1])
		else
			evolve:Notify( ply, evolve.colors.red, "No matching players found." )
		end
	else
		evolve:Notify( ply, evolve.colors.red, evolve.constants.notallowed )
	end
end

function PLUGIN:Menu( arg, players )
	if ( arg ) then
		RunConsoleCommand( "ev", "ibwarn", players[1] )
	else
		return "Give IB Warning", evolve.category.punishment
	end
end

evolve:RegisterPlugin( PLUGIN )